<script>
	export default {
		onLaunch: function() {
			uni.getLocation({
			    type: 'wgs84',
				geocode: true,
			    success: function (res) {
					uni.setStorageSync('getLocation', res)
			    }
			});
			let titleHeight = 0;  //状态栏和导航栏的总高度
			let naviBarHeight = 0 //导航栏高度
			const res = uni.getSystemInfoSync()
			const system = res.platform
			console.log('res ==>', res)
			let statusBarHeight = res.statusBarHeight; //状态栏高度
			if (system === 'android') {
				titleHeight = (48 + statusBarHeight)
			} else if (system === 'ios') {
				titleHeight = (44 + statusBarHeight)
			}
			naviBarHeight = titleHeight - statusBarHeight
			let systemInfo={
				system: system,
				titleHeight: titleHeight,
				statusBarHeight: statusBarHeight,
				naviBarHeight: naviBarHeight,
				windowWidth: res.windowWidth,
				windowHeight: res.windowHeight,
			}
			uni.setStorageSync('systemInfo', systemInfo)
			
			// #ifdef APP-PLUS
			// 检测升级
			uni.request({
			    url: 'https://uniapp.dcloud.io/update', //检查更新的服务器地址
			    data: {
			        appid: plus.runtime.appid,
			        version: plus.runtime.version,
			        imei: plus.device.imei
			    },
			    success: (res) => {
			        if (res.statusCode == 200 && res.data.isUpdate) {
			            let openUrl = plus.os.name === 'iOS' ? res.data.iOS : res.data.Android;
			            // 提醒用户更新
			            uni.showModal({
			                title: '更新提示',
			                content: res.data.note ? res.data.note : '是否选择更新',
			                success: (showResult) => {
			                    if (showResult.confirm) {
			                        plus.runtime.openURL(openUrl);
			                    }
			                }
			            })
			        }
			    }
			})
			// #endif
			
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		globalData: {  
			city: '南宁'  
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "uview-ui/index.scss";
	@import "@/assets/style/hami.scss";
	@import "@/common/iconfont.css";
</style>
